package com.yunji.cabinet.service.impl;

import com.yunji.cabinet.dao.IBindCodeLogsDao;
import com.yunji.cabinet.domain.BindCodeLogsDO;
import com.yunji.cabinet.domain.DeviceBindDO;
import com.yunji.cabinet.dto.DeviceBindDTO;
import com.yunji.common.utils.TimeUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.cabinet.service.impl
 * @FileName BindCodeLogsServiceImpl.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-03-30 10:02:33
 * @Description 货柜类型接口
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-03-30 10:02:33		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
@Service
public class BindCodeLogsService {

    @Resource
    private IBindCodeLogsDao bindCodeLogsDao;


    /**
     * @Title bindLog
     * @Desc 绑定日志信息
     * @Date 2024-06-07 15:33:05.387
     */
    public boolean bindLog(DeviceBindDTO dto) {
        BindCodeLogsDO log = new BindCodeLogsDO();
        log.setImei(dto.getImei());
        log.setQrCode(dto.getQrCode());
        log.setSn(dto.getSn());
        log.setOperateType(1);
        return bindCodeLogsDao.save(log);
    }


    /**
     * @Title unbindLog
     * @Desc 绑定日志信息
     * @Date 2024-06-07 15:33:05.387
     */
    public boolean unbindLog(DeviceBindDTO dto) {
        BindCodeLogsDO log = new BindCodeLogsDO();
        log.setImei(dto.getImei());
        log.setQrCode(dto.getQrCode());
        log.setSn(dto.getSn());
        log.setOperateType(2);
        return bindCodeLogsDao.save(log);
    }


}
